package org.domain.seam1.entity;

import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.web.RequestParameter;
import org.jboss.seam.framework.EntityHome;

import org.domain.seam1.entity.Address;

@Name("userHome")
public class UserHome extends EntityHome<User> {
	/**
	 * 
	 */
	private static final long serialVersionUID = -1114369241924502885L;
	@RequestParameter
	Long addressId;

	@Override
	public Object getId() {
		if (addressId == null) {
			return super.getId();
		} else {
			return addressId;
		}
	}

	@Override
	@Begin
	public void create() {
		super.create();
		getInstance().getRoles().add(new Role("admin"));
	}

	@Override
	public String remove() {
		String res = super.remove();
		clearInstance();
		return res;
	}



}
